All right, Now I have to make my mind blow up when somebody steps on it.
So I'm going to do that with the plate when somebody steps on the plate.
So go to the landmine plate.
Now, there's already explosion.
Sound on it.
We're going to need that.
But hit the plus on the plate.
I had a script and the script is going to be I'll call that boom.
We need a few variables.
The plate is going to be the main one, right?
So let's go.
Local plate equals and it just script off parent.
But we're also going to need a variable for the model because we have to do a cleanup once that blows
up, let's say a local land mine.
So we all make that one.
Just make that one word.
No caps, landmine plate dot parent Right.
So the script is here.
The parent of that is the plate.
The parent of that is the landmine.
All right.
We need a variable for whether it can or can't explode.
So I'll say can explode.
So once it blows up, we're going to turn it off that way.
The piece is the plate that goes flying doesn't hit somebody else and blow up again.
So I'll say true to start out for can explode.
We're also going to need the debris service to clean it up.
They get rid of it after everything is done in the workspace, we'll say gain, get service debris and
we're going to clone it.
We're going to spawn these, right.
Periodically spawn these.
So we need to clean them up.
Now.
I'm going to get my sound send that's on the plate right there, the plate dot.
And it's this one right here, explosion.
There it is.
Oh, and I want this to explode if anything hits it.
So if we go ahead and kick a ball on it, boom.
But we don't want it to explode by the ground or the surface that it's sitting on, in this case, it's
sitting on the terrain.
So if you have a floor, pay attention to this.
You're going to have to modify this a little bit.
I'm going to go to my boom script local surface, and I'm going to use the workspace terrain as the
surface.
So that's not going to detonate the bomb.
This is going to be an exclusion list right here.
Right.
But it's just going to be one value.
So I'm not making it a list.
It's an exclusion variable, say, local function on touch.
So this is if somebody touches the plate.
Other part, let's go ahead and get the touch event from the plate so we don't forget plate.
There it is touched, connect on touch, get rid of those two extra parentheses that Roblox always adds.
But you only want the function name.
You don't want the parentheses.
Now, if the other part does not equal, it's the little tilde, little tilde, the little squiggly
thing that's not equal to surface and can touch is true.
Then we're going to do our explosion.
But first we're going to say, Oh, I had can touch.
I meant can't explode.
We're going to make can explode false.
So this is each bomb is only going to be able to go off one time.
False.
It's done.
It will no longer explode.
After this point.
We're going to make a variable for our explosion exp for explosion instance, that new explosion or
parent it to we're comparing it to the to the plate, repairing it to the workspace if we wanted to.
Let's do that now.
It's good.
Like this plate and what else?
Exp position.
If you don't give it a position, it's going to blow up blow up at at the 000 part of the world, which
is no good.
We want to blow up where someone steps on it.
So when I say plate.
Possession.
That's where the explosion is going to happen.
We'll use the default blast pressure.
So we probably don't even need to set this.
But just so that you see that there's a blast blast pressure variable or property, it's normally 500,000,
so I'll make it 500,000.
Blast radius is going to make the biggest difference.
So if you do a blast radius too big, we're going to blow up too many things.
So let's make it like five.
All right.
What else?
We can blow holes in the terrain, but I think I'm going to set explosion type to enum explosion type.
No craters.
I don't want any craters in my terrain.
And then we'll play our sound.
Sound play.
Then let's turn the plate transparency off.
I'm not going to worry about the lid because it's going to go flying and then we're going to actually
destroy everything after the explosion and the sound plays.
So I'm just going to make the plate transparency invisible.
Make that one.
I'll get my debris, my debris service add item.
And that's going to be the model, the land mine.
And we will make it disappear after 2 seconds because our sound explosion.
Is 1.9 seconds long, so it might as well wait for the sound to play.
We put the sound on the plate and that will destroy everything.
All right.
That's pretty good.
I will put this in the resources in the folder so that you can download it.
All right.
In order to test this, let's make a couple of them.
I just had control to duplicate it.
Just drag that over.
Control day.
I'll do three and play.
Let's look at our view tab output.
Make sure there's no.
Make sure there's no errors.
Let's turn our zombies on.
Whoa.
Almost got me.
Yeah.
We go over here.
Run through the minefield.
Careful not to touch any of the plates.
Ha.
Nice.
And a body part.
Made the boulder roll.
That's pretty cool.
All right.
So good luck with that.
And I will see you in the next video.